package cn.wps.moffice.writer.io.writer.docx; import cn.wps.core.runtime.Platform; import cn.wps.moffice.extlibs.Qing3rdLoginConstants; import cn.wps.moffice.writer.core.TextDocument; import com.google.firebase.analytics.FirebaseAnalytics; import com.iflytek.cloud.SpeechConstant; import defpackage.msa; import defpackage.msb; import defpackage.msj; import defpackage.msm; import defpackage.msp; import defpackage.msq; import defpackage.msr; import defpackage.msv; import defpackage.msw; import defpackage.msx; import defpackage.msy; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; public class DocxWriter implements now { private static final String TAG = null; private static String mPath; private static TextDocument pxJ; private static boolean qtk = false; private static int qtl = 0; private static msj.g qtm; private static HashMap<Integer, oey> qtn = null; private static boolean qto = false; private static boolean qtp = false; private static ogq qtq; static final byte[] qtr = new byte[4096]; private alz oRs; private mzd qqc; public DocxWriter(TextDocument textDocument, String str, boolean z, alz alz) { this(textDocument, str, z, alz, mzd.FF_DOCX); } public DocxWriter(TextDocument textDocument, String str, boolean z, alz alz, mzd mzd) { ew.assertNotNull("document should not be null", textDocument); ew.assertNotNull("path should not be null", str); pxJ = textDocument; mPath = str; this.qqc = mzd; qtk = z; this.oRs = alz; qtl = 0; qtn = new HashMap<>(); msw dEi = pxJ.dDT().dEi(); mgh mgh = (mgh) textDocument.Oe(2); if (dEi != null) { qtm = dEi.dOv(); ofu.a(dEi.pjm, mgh == null ? null : Integer.valueOf(mgh.getLength())); return; } qtm = null; ofu.a((msj.h) null, mgh == null ? null : Integer.valueOf(mgh.getLength())); } /* JADX WARNING: Removed duplicated region for block: B:68:0x0322 */ private void MS(String str) throws aazi, IOException { File hcX; File hcX2; ejz dIJ; euw bbd; ew.assertNotNull("mFf should not be null!", this.qqc); mzd mzd = this.qqc; ew.assertNotNull("path should not be null!", str); ew.assertNotNull("formatType should not be null!", mzd); qtq = ogp.s(pxJ); abfo abfo = null; ode ode = null; try { abfo a = abfo.a(new File(str), mzd); try { ew.assertNotNull("doc should not be null", a); ode ode2 = new ode(pxJ, a); try { ode2.n(pxJ); File createTempFile = Platform.createTempFile("cmtDatasWriter_item", ".xml"); File createTempFile2 = Platform.createTempFile("cmtDatasWriter_props", ".xml"); ode2.pDW = ndz.a(createTempFile, createTempFile2, pxJ.dDT(), this); aazn aazn = ode2.pDW != null ? new aazn(createTempFile.getAbsolutePath(), createTempFile2.getAbsolutePath()) : null; ew.assertNotNull("part should not be null!", a); a(a, 0); a(a, 5); b(a); ode eeJ = ode.eeJ(); msm dEp = eeJ.pxJ.dDT().dEp(); if (dEp != null && !dEp.isEmpty()) { abfg d = abfg.d(a); odf odf = new odf(d.BVU.getOutputStream(), d); ofd.a(eeJ, odf); odf.close(); d.BVU.close(); } ode eeJ2 = ode.eeJ(); msm dEp2 = eeJ2.pxJ.dDT().dEp(); if (dEp2 != null && !dEp2.isEmpty()) { eeJ2.qsZ = true; abff c = abff.c(a); eeJ2.qsO = 3; a(c, 3); odf odf2 = new odf(c.BVU.getOutputStream(), c); ofc.a(eeJ2, odf2); odf2.close(); c.BVU.close(); eeJ2.qsZ = false; } ode eeJ3 = ode.eeJ(); eeJ3.eeM(); odf odf3 = new odf(a.BVU.getOutputStream(), a); eeJ3.qsO = 0; odf3.i("w:document", "xmlns:w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main", "xmlns:wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships", "xmlns:v", "urn:schemas-microsoft-com:vml", "xmlns:w10", "urn:schemas-microsoft-com:office:word", "xmlns:o", "urn:schemas-microsoft-com:office:office", "xmlns:wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", "xmlns:w14", "http://schemas.microsoft.com/office/word/2010/wordml", "xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006", "xmlns:m", "http://schemas.openxmlformats.org/officeDocument/2006/math", "xmlns:wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", "xmlns:wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", "xmlns:wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", "xmlns:wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", "mc:Ignorable", "w14 wp14"); mdl dDT = pxJ.dDT(); if (!(dDT.getType() != 0 || (dIJ = dDT.dDV().dIJ()) == null || (bbd = dIJ.bbd()) == null)) { odf3.i("w:background", "w:color", ogo.VS(bbd.getColor())); if (bbd.blW() != 0) { odf3.i("v:background", "o:bwmode", "white", "o:targetscreensize", "1024,768"); new ofl(dIJ, new oew(eeJ3, odf3)).dnS(); odf3.endElement("v:background"); } odf3.endElement("w:background"); } odf3.i("w:body", new String[0]); a(dDT, 0, dDT.getLength(), 0, odf3, 0); if (qtm == null || !qtm.hasNext()) { ew.eI(); } else { ofu.a((msw.b) qtm.dOx(), eeJ3, odf3); } odf3.endElement("w:body"); odf3.endElement("w:document"); odf3.close(); ode eeJ4 = ode.eeJ(); msq dEA = eeJ4.pxJ.dDT().dEA(); if (dEA != null && !dEA.isEmpty()) { abfp e = abfp.e(a); eeJ4.qsO = 4; a(e, 4); odf odf4 = new odf(e.BVU.getOutputStream(), e); ofi.a(eeJ4, odf4); odf4.close(); e.BVU.close(); } ode eeJ5 = ode.eeJ(); msq dEy = eeJ5.pxJ.dDT().dEy(); if (dEy != null && !dEy.isEmpty()) { abft g = abft.g(a); eeJ5.qsO = 1; a(g, 1); odf odf5 = new odf(g.BVU.getOutputStream(), g); ofm.a(eeJ5, odf5); odf5.close(); g.BVU.close(); } a(a); ofa.b(ode.eeJ(), a); eeN(); abge i = abge.i(a); odf odf6 = new odf(i.BVU.getOutputStream(), i); ofv.a(pxJ, odf6); odf6.close(); i.BVU.close(); b(ode2); ew.assertNotNull("dctx should not be null", ode2); ew.assertNotNull("doc should not be null", a); TextDocument textDocument = ode2.pxJ; ew.assertNotNull("textDoc should not be null", textDocument); mlm mlm = textDocument.oRg; ew.assertNotNull("metaData should not be null", mlm); ew.assertNotNull("textDoc should not be null", textDocument); ew.assertNotNull("doc should not be null", a); aazw hda = a.hda(); ew.assertNotNull("packageProperties should not be null", hda); if (hda != null) { ew.assertNotNull("packageProperties should not be null", hda); ew.assertNotNull("textDoc should not be null", textDocument); mlm mlm2 = textDocument.oRg; ew.assertNotNull("metaData should not be null", mlm2); mln dKy = mlm2.dKy(); ew.assertNotNull("docSummaryInfo should not be null", dKy); mlo dKx = mlm2.dKx(); ew.assertNotNull("summaryInfo should not be null", dKx); String str2 = textDocument.cjM; if (str2 != null) { ew.assertNotNull("version should not be null", str2); ew.assertNotNull("packageProperties should not be null", hda); if (str2.length() > 0) { hda.ahZ(str2); } } ew.assertNotNull("packageProperties should not be null", hda); ew.assertNotNull("docSummaryInfo should not be null", dKy); ew.assertNotNull("summaryInfo should not be null", dKx); String category = dKy.getCategory(); if (ogi.Lq(category)) { hda.ahP(category); } String dKN = dKy.dKN(); if (ogi.Lq(dKN)) { hda.ahQ(dKN); } Date createTime = dKx.getCreateTime(); if (createTime != null) { hda.a(new abbb<>(createTime)); } String aLv = dKx.aLv(); if (ogi.Lq(aLv)) { hda.ahR(aLv); } String dKP = dKx.dKP(); if (ogi.Lq(dKP)) { hda.ahS(dKP); } String bQf = dKx.bQf(); if (ogi.Lq(bQf)) { hda.ahT(bQf); } String language = dKy.getLanguage(); if (ogi.Lq(language)) { hda.ahU(language); } String userName = Platform.getUserName(); if (!ogi.Lq(userName)) { userName = "WPS Office"; } hda.ahV(userName); Date dKU = dKx.dKU(); if (dKU != null) { Calendar instance = Calendar.getInstance(); instance.setTime(dKU); if (instance.get(1) <= 1600) { dKU = new Date(); } hda.b(new abbb<>(dKU)); } hda.c(new abbb<>(new Date())); Integer dKS = dKx.dKS(); if (dKS != null) { hda.ahW(dKS.toString()); } String subject = dKx.getSubject(); if (ogi.Lq(subject)) { hda.ahX(subject); } String title = dKx.getTitle(); if (ogi.Lq(title)) { hda.ahY(title); } } ew.assertNotNull("textDoc should not be null", textDocument); ew.assertNotNull("doc should not be null", a); abah abah = (abah) a.hdb(); ew.assertNotNull("extendedProperties should not be null", abah); if (abah != null) { ew.assertNotNull("extendedProperties should not be null", abah); ew.assertNotNull("textDocument should not be null", textDocument); mlm mlm3 = textDocument.oRg; ew.assertNotNull("metaData should not be null", mlm3); mln dKy2 = mlm3.dKy(); ew.assertNotNull("docSummaryInfo should not be null", dKy2); mlo dKx2 = mlm3.dKx(); ew.assertNotNull("summaryInfo should not be null", dKx2); ew.assertNotNull("extendedProperties should not be null", abah); ew.assertNotNull("docSummaryInfo should not be null", dKy2); ew.assertNotNull("summaryInfo should not be null", dKx2); ew.assertNotNull("textDocument should not be null", textDocument); abah.ahE("WPS Office"); String dKO = dKy2.dKO(); if (dKO != null && dKO.length() > 0) { ew.assertNotNull("appVersion should not be null", dKO); abah.ahF(dKO.split("\\.")[0] + ".000"); } abah.azj(ofj.p(textDocument)); abah.azq(ofj.o(textDocument)); String dKG = dKy2.dKG(); if (ogi.Lq(dKG)) { abah.ahG(dKG); } Integer dKZ = dKx2.dKZ(); if (dKZ != null && nzn.UX(dKZ.intValue())) { abah.azk(dKZ.intValue()); } String dKK = dKy2.dKK(); if (dKK != null) { abah.ahH(dKK); } Boolean dKL = dKy2.dKL(); if (dKL != null) { abah.NI(dKL.booleanValue()); } Boolean dKH = dKy2.dKH(); if (dKH != null) { abah.NJ(dKH.booleanValue()); } String dKF = dKy2.dKF(); if (ogi.Lq(dKF)) { abah.ahI(dKF); } Integer dKD = dKy2.dKD(); if (dKD != null) { abah.azl(dKD.intValue()); } Integer dKW = dKx2.dKW(); if (dKW != null) { abah.azm(dKW.intValue()); } abah.azn(ofj.q(textDocument)); Boolean dKE = dKy2.dKE(); if (dKE != null) { abah.NK(dKE.booleanValue()); } Boolean dKJ = dKy2.dKJ(); if (dKJ != null) { abah.NL(dKJ.booleanValue()); } String dKQ = dKx2.dKQ(); if (ogi.Lq(dKQ)) { abah.ahJ(dKQ); } Long dKT = dKx2.dKT(); if (dKT != null) { float j = fh.j(dKT.longValue()); ew.eH(); if (j < 0.0f) { j = 0.0f; } abah.azo((int) j); } abah.azp(ofj.r(textDocument)); } ew.assertNotNull("metaData should not be null", mlm); ew.assertNotNull("doc should not be null", a); mll dKw = mlm.dKw(); aazm hdc = a.hdc(); ew.assertNotNull("extendedProperties should not be null", hdc); if (hdc != null) { ofe.a(dKw, hdc); } ArrayList<aazn> arrayList = mlm.oYO; if (aazn != null) { if (arrayList == null) { arrayList = new ArrayList<>(); } arrayList.add(aazn); } if (!(arrayList == null || arrayList.size() == 0)) { off.a(arrayList, a); } c(ode2); eeO(); eeP(); a(ode2, a); eeQ(); a.BVS.close(); if (ode2 != null) { ode2.dispose(); } if (!(a == null || (hcX2 = a.BVS.hcX()) == null || !hcX2.exists())) { hcX2.delete(); } dispose(); qtq.unlock(); } catch (Throwable th) { th = th; ode = ode2; abfo = a; if (ode != null) { } hcX.delete(); dispose(); qtq.unlock(); throw th; } } catch (Throwable th2) { th = th2; abfo = a; if (ode != null) { } hcX.delete(); dispose(); qtq.unlock(); throw th; } } catch (Throwable th3) { th = th3; if (ode != null) { ode.dispose(); } if (!(abfo == null || (hcX = abfo.BVS.hcX()) == null || !hcX.exists())) { hcX.delete(); } dispose(); qtq.unlock(); throw th; } } private static void Vk(int i) throws Cnew { if (qtk) { ew.assertNotNull("mDocument should not be null!", pxJ); ew.assertNotNull("mPath should not be null!", mPath); int i2 = qtl + i; qtl = i2; if (i2 > 10) { qtl = 0; if (qtk && pxJ.oRy) { lul.In(mPath); qtq.unlock(); throw new Cnew("forbid autosave"); } } } } private static ArrayList<Integer> a(ode ode, odf odf, int i, mdl mdl, ArrayList<Integer> arrayList) { ArrayList<String> arrayList2; int size; if (!(mdl.getType() != 0 || ode.pDW == null || 5 != mdl.charAt(i) || (arrayList2 = ode.pDW.get(Integer.valueOf(i))) == null || (size = arrayList2.size()) == 0)) { if (arrayList == null) { arrayList = new ArrayList<>(); } for (int i2 = 0; i2 < size; i2++) { String str = arrayList2.get(i2); if (!ndz.KG(str)) { a(ode, odf, arrayList, str); } } } return arrayList; } private static msa.a a(ode ode, mdl mdl, msa.a aVar, odf odf, oey oey, int i, int i2, int i3) throws IOException { zyn w = msh.w(mdl, i2, i2 + i3); if (w == null || w.isEmpty()) { return b(ode, mdl, aVar, odf, oey, i, i2, i3); } int i4 = w.get(0) - i2; int size = w.size(); if (i4 == 0 && 1 == size) { return b(ode, mdl, aVar, odf, oey, i, i2, i3); } if (i4 != 0 && 1 == size) { b(ode, mdl, aVar, odf, oey, i, i2, i4); return b(ode, mdl, aVar, odf, oey, i, i2 + i4, i3 - i4); } else if (i4 != 0 || 1 >= size) { b(ode, mdl, aVar, odf, oey, i, i2, i4); int i5 = i2 + i4; for (int i6 = 1; i6 < size; i6++) { int i7 = w.get(i6) - w.get(i6 - 1); b(ode, mdl, aVar, odf, oey, i, i5, i7); i5 += i7; } return b(ode, mdl, aVar, odf, oey, i, i5, (i2 + i3) - i5); } else { int i8 = i2; for (int i9 = 1; i9 < size; i9++) { int i10 = w.get(i9) - w.get(i9 - 1); b(ode, mdl, aVar, odf, oey, i, i8, i10); i8 += i10; } return b(ode, mdl, aVar, odf, oey, i, i8, (i2 + i3) - i8); } } public static msa.a a(ode ode, mdl mdl, msa.a aVar, odf odf, oey oey, int i, ArrayList<Integer> arrayList) throws IOException { int intValue; int i2; int length = aVar.length(); int Vj = ode.Vj(i); msa.a aVar2 = null; int i3 = 0; int i4 = 0; while (i3 < length) { if (i4 == 0) { intValue = arrayList.get(i4).intValue() - Vj; i2 = i4 + 1; } else if (i4 >= arrayList.size()) { intValue = length - i3; i2 = i4; } else { intValue = (arrayList.get(i4).intValue() - i3) - Vj; i2 = i4 + 1; } aVar2 = a(ode, mdl, aVar, odf, oey, i, i3 + Vj, intValue); i3 += intValue; i4 = i2; } return aVar2 == null ? aVar.dOd() : aVar2; } private static void a(aago aago, int i) { ew.assertNotNull("part should not be null!", aago); zyr<String> dIG = pxJ.dIG(); if (dIG.size() != 0) { ArrayList<Integer> On = pxJ.On(i); if (On.size() != 0) { int size = On.size(); for (int i2 = 0; i2 < size; i2++) { String str = dIG.get(On.get(i2).intValue()); if (str != null) { aago.ahn(str); } } } } } private void a(aago aago, mgh mgh, int i, int i2) { String str; msy.b QN; zyr<String> dIG = pxJ.dIG(); if (dIG.size() != 0) { int i3 = mgh.mType; ArrayList<Integer> On = pxJ.On(i3); int size = On.size(); msx msx = mgh.oQr; msj.g d = msx.d(msx.Qa(i).dOF()); while (d.hasNext()) { msx.a aVar = (msx.a) d.dOx(); if (d.start < i2) { int i4 = aVar.eWz; if (2 == i3) { ew.assertNotNull("part should not be null!", aago); mgh mgh2 = (mgh) pxJ.Oe(6); msy msy = mgh2.oQs; if (!(msy == null || msy.mSize == 0 || (QN = msy.QN(i4)) == null)) { int dOw = QN.dOw(); msj.h dOG = QN.dOG(); a(aago, mgh2, dOw, msy.b(dOG) ? mgh2.getLength() : dOG.dOw()); } } if (size > 0 && On.contains(Integer.valueOf(i4)) && (str = dIG.get(i4)) != null) { aago.ahn(str); } } else { return; } } } } private static void a(aazt aazt, String str) { FileInputStream fileInputStream; Throwable th; Exception e; try { OutputStream outputStream = aazt.getOutputStream(); fileInputStream = new FileInputStream(str); while (true) { try { int read = fileInputStream.read(qtr); if (read != -1) { outputStream.write(qtr, 0, read); } else { lul.closeQuietly(fileInputStream); return; } } catch (FileNotFoundException e2) { e = e2; try { hm.e(TAG, "FileNotFoundException: ", e); lul.closeQuietly(fileInputStream); } catch (Throwable th2) { th = th2; lul.closeQuietly(fileInputStream); throw th; } } catch (Exception e3) { e = e3; hm.e(TAG, "Exception: ", e); lul.closeQuietly(fileInputStream); } } } catch (FileNotFoundException e4) { e = e4; fileInputStream = null; hm.e(TAG, "FileNotFoundException: ", e); lul.closeQuietly(fileInputStream); } catch (Exception e5) { e = e5; fileInputStream = null; hm.e(TAG, "Exception: ", e); lul.closeQuietly(fileInputStream); } catch (Throwable th3) { th = th3; fileInputStream = null; lul.closeQuietly(fileInputStream); throw th; } } private static void a(abfo abfo) throws Cnew { String str; ew.assertNotNull("doc should not be null!", abfo); mfl mfl = pxJ.oRd; if (mfl != null) { abgf j = abgf.j(abfo); ew.assertNotNull("stylesPart should not be null!", j); OutputStream outputStream = j.BVU.getOutputStream(); ew.assertNotNull("os should not be null!", outputStream); ode eeJ = ode.eeJ(); odf odf = new odf(outputStream, j); odf.i("w:styles", "xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006", "xmlns:w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main", "xmlns:w14", "http://schemas.microsoft.com/office/word/2010/wordml", "mc:Ignorable", "w14"); odf.i("w:docDefaults", new String[0]); odf.i("w:rPrDefault", new String[0]); oft.b(eeJ, odf, mfl.oPk); odf.endElement("w:rPrDefault"); odf.i("w:pPrDefault", new String[0]); ofq.a(eeJ, odf, mfl.oPl); odf.endElement("w:pPrDefault"); odf.endElement("w:docDefaults"); ArrayList<mfk> arrayList = mfl.oPm; ew.assertNotNull("styleArray should not be null!", arrayList); int size = arrayList.size(); int i = size >= 4085 ? 4085 : size; for (int i2 = 0; i2 < i; i2++) { mfk mfk = arrayList.get(i2); ew.assertNotNull("style should not be null!", mfk); ode eeJ2 = ode.eeJ(); if (!(mfk == null || mfk.id == 4095)) { ew.assertNotNull("ctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("style should not be null", mfk); ArrayList<String> arrayList2 = new ArrayList<>(10); ew.assertNotNull("ctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("style should not be null", mfk); ew.assertNotNull("attrs should not be null", arrayList2); int i3 = mfk.type; arrayList2.add("w:type"); switch (i3) { case 1: str = "paragraph"; break; case 2: str = FirebaseAnalytics.Param.CHARACTER; break; case 3: str = "table"; break; case 4: str = "numbering"; break; default: ew.eJ(); str = "paragraph"; break; } arrayList2.add(str); if (mfk.id == 0 || mfk.id == 65 || mfk.id == 105 || mfk.id == 107) { arrayList2.add("w:default"); arrayList2.add("1"); } else if (mfk.dGJ()) { arrayList2.add("w:customStyle"); arrayList2.add("1"); } arrayList2.add("w:styleId"); arrayList2.add(ode.Vi(mfk.id)); odf.d("w:style", arrayList2); ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("style should not be null", mfk); String name = nnf.getName(mfk.id); if (name == null || name.length() <= 0) { name = mfk.name; } if (name != null) { odf.fE("w:name", name); } int i4 = mfk.oOZ; if (i4 != 4095) { odf.fE("w:basedOn", ode.Vi(i4)); } int i5 = mfk.oPa; if (i5 != 4095) { odf.fE("w:next", ode.Vi(i5)); } int i6 = mfk.oPb; if (!(i6 == 4095 || i6 == 0)) { odf.fE("w:link", ode.Vi(i6)); } if (mfk.oPc) { odf.j("w:qFormat", new String[0]); } long j2 = mfk.oPd; if (-1 != j2) { odf.fE("w:uiPriority", Long.toString(j2)); } kgd kgd = mfk.oPf; ew.assertNotNull("property should not be null", kgd); switch (mfk.type) { case 1: ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("property should not be null", kgd); ofq.a(eeJ2, odf, kgd); oft.b(eeJ2, odf, kgd); break; case 2: ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("property should not be null", kgd); oft.b(eeJ2, odf, kgd); break; case 3: ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("property should not be null", kgd); ofq.a(eeJ2, odf, kgd); oft.b(eeJ2, odf, kgd); ogb.b(eeJ2, odf, kgd); ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("property should not be null", kgd); ofz.a(eeJ2, odf, 329, 264, 87, kgd); ofz.a(eeJ2, odf, 330, 265, 88, kgd); ofz.a(eeJ2, odf, 331, 266, 89, kgd); ofz.a(eeJ2, odf, 332, 267, 90, kgd); ofz.a(eeJ2, odf, 333, 268, 91, kgd); ofz.a(eeJ2, odf, 334, 269, 92, kgd); ofz.a(eeJ2, odf, 335, 270, 93, kgd); ofz.a(eeJ2, odf, 336, 271, 94, kgd); ofz.a(eeJ2, odf, 337, 272, 95, kgd); ofz.a(eeJ2, odf, 338, 273, 96, kgd); ofz.a(eeJ2, odf, 339, 274, 97, kgd); ofz.a(eeJ2, odf, 340, 275, 98, kgd); ofz.a(eeJ2, odf, 341, 276, 99, kgd); ew.assertNotNull("stylePropSet should not be null", kgd); odf.i("w:tcPr", new String[0]); ofz.e(odf, kgd); ofz.d(odf, kgd); ofz.c(odf, kgd); ofz.b(odf, kgd); ofz.f(odf, kgd); odf.endElement("w:tcPr"); break; case 4: ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("property should not be null", kgd); ofq.a(eeJ2, odf, kgd); break; default: ew.eI(); break; } odf.endElement("w:style"); } Vk(5); } odf.endElement("w:styles"); odf.close(); j.BVU.close(); } } /* JADX WARNING: Removed duplicated region for block: B:62:0x0291 */ /* JADX WARNING: Removed duplicated region for block: B:78:0x0325 */ public static void a(mdl mdl, int i, int i2, int i3, odf odf, int i4) throws IOException { msw.b bVar; msb.a dOi; ew.eG(); ode eeJ = ode.eeJ(); switch (i4) { case 5: case 6: eeJ.qsN = i; break; default: eeJ.aNp = i; break; } oey aX = aX(i4, i, i2); msb.a PS = mdl.dDZ().PS(i); while (i < i2) { if ((5 != i4 && 6 != i4) || i3 != 0 || i != i2 - 1) { if (odn.e(PS, i3)) { ode eeJ2 = ode.eeJ(); odn odn = new odn(mdl, PS, i3 + 1); odf.i("w:tbl", new String[0]); ogb.b(eeJ2, odf, odn.dGK()); odl odl = odn.qtF; odf.i("w:tblGrid", new String[0]); oga.a(odf, odl); odh odh = odl.qtE; if (odh != null) { int i5 = eeJ2.qsU; eeJ2.qsU = i5 + 1; odf.i("w:tblGridChange", "w:id", Integer.toString(i5)); odf.i("w:tblGrid", new String[0]); oga.a(odf, odh); odf.endElement("w:tblGrid"); odf.endElement("w:tblGridChange"); } odf.endElement("w:tblGrid"); boolean z = true; ArrayList<odj> arrayList = odn.pgj; int size = arrayList.size(); int i6 = 0; while (i6 < size) { odj odj = arrayList.get(i6); boolean z2 = i6 != 0 ? false : z; odf.i("w:tr", new String[0]); if (!z2) { ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("row should not be null", odj); ew.assertNotNull("w should not be null", odf); odf.i("w:tblPrEx", new String[0]); kgd dGK = odj.qtA.dGK(); kgd kgd = odj.qtC.lXN; mzt mzt = (mzt) kgd.sp(363); if (mzt == null || !kgd.getBoolean(364, false)) { kfz kfz = new kfz(kgd); kfz.b(dGK); ogc.e(eeJ2, odf, kfz.lXN); } else { kfz kfz2 = new kfz(mzt.oPf); mzt mzt2 = (mzt) dGK.sp(363); if (mzt2 != null && dGK.getBoolean(364, false)) { kfz2.b(mzt2.oPf); ogc.e(eeJ2, odf, kfz2.lXN); } kfz kfz3 = new kfz(odj.qtB.qtD); kfz3.b(dGK); kgd kgd2 = kfz3.lXN; ew.assertNotNull("dctx should not be null", eeJ2); ew.assertNotNull("w should not be null", odf); ew.assertNotNull("tblPrEx should not be null", kgd2); if (kgd2.mCount != 0) { eeJ2.a("w:tblPrExChange", mzt, odf); odf.i("w:tblPrEx", new String[0]); ogc.e(eeJ2, odf, kgd2); odf.endElement("w:tblPrEx"); odf.endElement("w:tblPrExChange"); } } odf.endElement("w:tblPrEx"); } ogg.a(eeJ2, odj, odf); int size2 = odj.oMW.size(); for (int i7 = 0; i7 < size2; i7++) { odf.i("w:tc", new String[0]); odb odb = odj.oMW.get(i7); odf.i("w:tcPr", new String[0]); ogd.a(eeJ2, odf, odb); odf.endElement("w:tcPr"); int position = odb.pBr.position(); int position2 = odb.pBs.dOi().position(); ew.eG(); a(mdl, position, position2, odb.qss.jmi, odf, i4); odf.endElement("w:tc"); aX.a(eeJ2, eeJ2.Vj(i4), odf, i4); } odf.endElement("w:tr"); eeJ2.hE(i4, 1); aX.a(eeJ2, eeJ2.Vj(i4), odf, i4); i6++; z = z2; } odf.endElement("w:tbl"); dOi = odn.pBO.dOi(); } else { msb.a dOi2 = PS.dOi(); boolean z3 = dOi2.FH() ? true : dOi2.position() == i2; ode eeJ3 = ode.eeJ(); msa.a PR = mdl.dDY().PR(PS.dOj() - 1); Integer num = eeJ3.qtb; ArrayList<String> arrayList2 = new ArrayList<>(); if (z3 && num != null) { arrayList2.add("w14:paraId"); arrayList2.add(String.valueOf(num)); } odf.d("w:p", arrayList2); if (i4 == 0) { if (qtm == null || !qtm.hasNext()) { bVar = null; ofq.a(eeJ3, odf, PS.dGK(), PR.FH() ? null : PR.dGK(), bVar, mdl); PS.position(); a(eeJ3, mdl, mdl.dDY().PR(PS.position()), PR, odf, aX, i4); aX.a(eeJ3, eeJ3.Vj(i4), odf, i4); odf.endElement("w:p"); eeJ3.hE(i4, 1); aX.a(eeJ3, eeJ3.Vj(i4), odf, i4); dOi = PS.dOi(); } else { int dOj = PS.dOj() - 1; if ('\f' == mdl.charAt(dOj)) { msj.h dOx = qtm.dOx(); if (qtm.getEnd() == dOj) { bVar = (msw.b) dOx; ofq.a(eeJ3, odf, PS.dGK(), PR.FH() ? null : PR.dGK(), bVar, mdl); PS.position(); a(eeJ3, mdl, mdl.dDY().PR(PS.position()), PR, odf, aX, i4); aX.a(eeJ3, eeJ3.Vj(i4), odf, i4); odf.endElement("w:p"); eeJ3.hE(i4, 1); aX.a(eeJ3, eeJ3.Vj(i4), odf, i4); dOi = PS.dOi(); } } } } bVar = null; ofq.a(eeJ3, odf, PS.dGK(), PR.FH() ? null : PR.dGK(), bVar, mdl); PS.position(); a(eeJ3, mdl, mdl.dDY().PR(PS.position()), PR, odf, aX, i4); aX.a(eeJ3, eeJ3.Vj(i4), odf, i4); odf.endElement("w:p"); eeJ3.hE(i4, 1); aX.a(eeJ3, eeJ3.Vj(i4), odf, i4); dOi = PS.dOi(); } if (dOi.FH()) { PS = dOi; i = i2; } else { i = dOi.position(); PS = dOi; } } else { return; } } } private static void a(nmf nmf, aago aago, int i) throws IOException { ew.assertNotNull("chartObject should not be null", nmf); ew.assertNotNull("chartDataPart should not be null", aago); String str = nmf.pNQ; String str2 = nmf.contentType; String str3 = nmf.path; abgb aiJ = abgb.aiJ(str2); aago a = aago.a(aiJ, abfq.heV(), ogi.a(aago, i, aiJ), str); try { FileInputStream fileInputStream = new FileInputStream(str3); lul.e(fileInputStream, a.BVU.getOutputStream()); fileInputStream.close(); nmf[] nmfArr = nmf.pNR; if (nmfArr != null) { int length = nmfArr.length; for (int i2 = 0; i2 < length; i2++) { nmf nmf2 = nmfArr[i2]; if (nmf2 != null) { a(nmf2, a, i2); } } } } catch (FileNotFoundException e) { ew.eI(); } catch (IOException e2) { hm.e(TAG, "IOException", e2); if (eia.e(e2)) { throw e2; } } } private static void a(ode ode, abfo abfo) throws IOException { ew.assertNotNull("dctx should not be null", ode); ew.assertNotNull("doc should not be null", abfo); HashMap<String, List<aago>> dXH = ode.dXH(); ew.assertNotNull("diagramPartMap should not be null", dXH); if (dXH.size() > 0) { for (Map.Entry<String, List<aago>> entry : dXH.entrySet()) { ew.assertNotNull("entry should not be null", entry); String key = entry.getKey(); ew.assertNotNull("path should not be null", key); List<aago> value = entry.getValue(); ew.assertNotNull("parts should not be null", value); int size = value.size(); for (int i = 0; i < size; i++) { aago aago = value.get(i); ew.assertNotNull("part should not be null", aago); ogi.c(aago, key); } } } } private static void a(ode ode, mdl mdl, msa.a aVar, msa.a aVar2, odf odf, oey oey, int i) throws IOException { msa.a aVar3 = aVar; while (aVar3 != aVar2) { int Vj = ode.Vj(i); int position = aVar3.dOd().position() - Vj; ArrayList<Integer> a = oey.a(ode, odf, i, position); aVar3 = !a.isEmpty() ? a(ode, mdl, aVar3, odf, oey, i, a) : a(ode, mdl, aVar3, odf, oey, i, Vj, position); } } private static void a(ode ode, msp.a aVar, mdl mdl, msa.a aVar2) { String cw; if (20 == aVar.pjR) { if (ode.qtd == null) { ode.qtd = new ArrayList<>(); } Long dOO = aVar.dOO(); if (dOO != null) { int longValue = (int) (dOO.longValue() >>> 32); int longValue2 = (int) dOO.longValue(); int i = longValue2 - longValue; char[] cArr = new char[i]; mdl.c(longValue, longValue2, cArr, 0); mun mun = new mun(); try { mun.a(cArr, i); odg odg = new odg(); Object sp = aVar2.dGK().sp(56); if (sp == null) { cw = null; } else { ejt baz = ((ejz) sp).baz(); if (baz == null) { cw = null; } else { cw = mdl.dDV().dIf().cw(baz.bal(), ewg.fnr); if (baz.ban()) { cw = ndz.fr(cw, baz.bam()); } } } odg.qtt = cw; odg.qtu = "0"; odg.ckp = mun.pog; if (mun.pnY.size() > 0) { odg.pRX = mun.Ra(0).mTT; } if (odg.qtt != null) { ode.qtd.add(odg); } } catch (mva e) { hm.d(TAG, "UnKnownSwitchAgrument", e); } } } } private static void a(ode ode, odf odf, ArrayList<Integer> arrayList, String str) { int i = ode.qsP; ode.qsP = i + 1; arrayList.add(Integer.valueOf(i)); odf.j("w:bookmarkStart", "w:id", String.valueOf(i), "w:name", str); } private static void a(odf odf, ArrayList<Integer> arrayList) { if (arrayList != null) { int size = arrayList.size(); if (!(arrayList == null || size == 0)) { for (int i = 0; i < size; i++) { odf.j("w:bookmarkEnd", "w:id", String.valueOf(arrayList.get(i))); } } } } private static boolean a(ode ode) { return ode.qsC > 0; } private static boolean aB(char c) { return c == '\t' || c == 11 || c == '\f' || c == 14 || c == '\r'; } private static boolean aC(char c) { return 30 == c; } public static oey aX(int i, int i2, int i3) { ew.assertNotNull("mCommentBookupMap should not be null! ", qtn); oey oey = qtn.get(Integer.valueOf(i)); if (oey != null) { return oey; } oey oey2 = new oey(pxJ, i); qtn.put(Integer.valueOf(i), oey2); oey2.hF(i2, i3); return oey2; } private static HashMap<Integer, Integer> b(HashMap<Integer, muf> hashMap, HashMap<Integer, Integer> hashMap2) { HashMap<Integer, Integer> hashMap3 = new HashMap<>(); for (Map.Entry<Integer, muf> entry : hashMap.entrySet()) { Integer key = entry.getKey(); ew.assertNotNull("lsid should not be null", key); Integer num = hashMap2.get(key); if (num != null) { muf value = entry.getValue(); ew.assertNotNull("lstData should not be null", value); hashMap3.put(Integer.valueOf(value.dJD()), num); } } return hashMap3; } private static msa.a b(ode ode, mdl mdl, msa.a aVar, odf odf, oey oey, int i, int i2, int i3) throws IOException { ArrayList arrayList; ArrayList arrayList2 = null; int i4 = 0; if (ogl.Y(mdl, i2)) { ogl ogl = new ogl(mdl, ode, odf, oey); ogl.qug.i("m:oMathPara", new String[0]); msv.b QD = ogl.oGv.dEs().QD(i2); if (QD.pkj.pkf) { ogl.qug.i("m:oMathParaPr", new String[0]); Integer num = QD.pkj.pkh; if (num != null) { ogl.qug.j("m:jc", "m:val", oft.w(num)); } ogl.qug.endElement("m:oMathParaPr"); } int X = ogl.X(ogl.oGv, i2); int VP = ogl.VP(i2); msa.a hH = ogl.hH(i2, ogl.VP(i2)); ogl.qug.endElement("m:oMathPara"); return VP < X ? ogl.hH(VP, X) : hH; } else if (msh.I(mdl, i2)) { ogl ogl2 = new ogl(mdl, ode, odf, oey); return ogl2.hH(i2, ogl.X(ogl2.oGv, i2)); } else { if (!ode.qtc && mdl.getType() == 0) { if (mdl.getType() != 0) { arrayList = null; } else if (ode.pDW == null) { arrayList = null; } else { ArrayList<String> arrayList3 = ode.pDW.get(0); if (arrayList3 == null) { arrayList = null; } else { int size = arrayList3.size(); if (size == 0) { arrayList = null; } else { ArrayList arrayList4 = new ArrayList(); while (true) { if (i4 >= size) { break; } String str = arrayList3.get(i4); if (ndz.KG(str)) { a(ode, odf, arrayList4, str); break; } i4++; } arrayList = arrayList4; } } } ode.qtc = true; arrayList2 = arrayList; } ArrayList<Integer> a = a(ode, odf, i2, mdl, arrayList2); c(ode, mdl, aVar, odf, oey, i, i2, i3); a(odf, a); return msh.K(mdl, i2 + i3); } } private void b(abfo abfo) throws Cnew { boolean z; Integer valueOf; abfx h = abfx.h(abfo); odf odf = new odf(h.BVU.getOutputStream(), h); odf.i("w:numbering", "xmlns:wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", "xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006", "xmlns:o", "urn:schemas-microsoft-com:office:office", "xmlns:r", "http://schemas.openxmlformats.org/package/2006/relationships", "xmlns:m", "http://schemas.openxmlformats.org/officeDocument/2006/math", "xmlns:v", "urn:schemas-microsoft-com:vml", "xmlns:wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", "xmlns:wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "xmlns:w10", "urn:schemas-microsoft-com:office:word", "xmlns:w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main", "xmlns:w14", "http://schemas.microsoft.com/office/word/2010/wordml", "xmlns:wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", "xmlns:wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", "xmlns:wne", "http://schemas.microsoft.com/office/word/2006/wordml", "xmlns:wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", "mc:Ignorable", "w14 wp14"); ode eeJ = ode.eeJ(); ew.assertNotNull("dctx should not be null", eeJ); mtx dIo = pxJ.dIo(); ew.assertNotNull("autoNumTable should not be null", dIo); TextDocument textDocument = eeJ.pxJ; ew.assertNotNull("document should not be null", textDocument); mfl mfl = textDocument.oRd; mud mud = dIo.oYB; ew.assertNotNull("lfoTable should not be null.", mud); HashMap<Integer, muc> hashMap = mud.pmy; ew.assertNotNull("lfoDataMap should not be null", hashMap); HashMap hashMap2 = new HashMap(); ew.assertNotNull("lfoDataMap should not be null", hashMap); for (Map.Entry<Integer, muc> entry : hashMap.entrySet()) { Integer key = entry.getKey(); ew.assertNotNull("numId should not be null", key); muc value = entry.getValue(); ew.assertNotNull("lfoData should not be null", value); if (mfl != null) { int size = mfl.oPm.size(); for (int i = 0; i < size; i++) { mfk NV = mfl.NV(i); ew.assertNotNull("style should not be null", NV); if (4 == NV.type) { kgd kgd = NV.oPf; ew.assertNotNull("propSet should not be null", kgd); if (!(kgd == null || (valueOf = Integer.valueOf(kgd.getInt(235, -1))) == null || key.intValue() != valueOf.intValue())) { hashMap2.put(Integer.valueOf(value.pmw.plU), Integer.valueOf(NV.id)); } } } } } ew.assertNotNull("lsidStiMap should not be null", hashMap2); mug mug = dIo.oYy; ew.assertNotNull("lstTable should not be null", mug); HashMap<Integer, muf> hashMap3 = mug.pmC; ew.assertNotNull("lstDataMap should not be null", hashMap3); HashMap<Integer, Integer> b = b(hashMap3, hashMap2); ew.assertNotNull("tmplStiMap should not be null", b); for (Map.Entry<Integer, muf> entry2 : hashMap3.entrySet()) { Integer key2 = entry2.getKey(); ew.assertNotNull("abstractNumId should not be null", key2); int index = mug.getIndex(key2.intValue()) - 1; ew.eH(); muf value2 = entry2.getValue(); ew.assertNotNull("lstData should not be null", value2); ew.assertNotNull("dctx should not be null", eeJ); ew.assertNotNull("lstData should not be null", value2); ew.assertNotNull("lsidStyleIdMap should not be null", hashMap2); ew.assertNotNull("tmplStiMap should not be null", b); ew.assertNotNull("w should not be null", odf); mua mua = value2.pmA; ew.assertNotNull("lstf should not be null", mua); odf.i("w:abstractNum", "w:abstractNumId", Integer.toString(index)); odf.fE("w:nsid", String.format("%08X", Integer.valueOf(index))); odf.fE("w:multiLevelType", mua.pmf ? "singleLevel" : mua.pmi ? "hybridMultilevel" : "multilevel"); odf.fE("w:tmpl", String.format("%08X", Integer.valueOf(mua.pmd))); Integer num = (Integer) hashMap2.get(Integer.valueOf(value2.dPy())); if (num != null) { odf.fE("w:styleLink", ode.Vi(num.intValue())); z = true; } else { Integer num2 = b.get(Integer.valueOf(value2.dJD())); if (num2 != null) { odf.fE("w:numStyleLink", ode.Vi(num2.intValue())); z = false; } else { z = true; } } if (mua.name != null) { odf.fE("w:name", mua.name); } TextDocument textDocument2 = eeJ.pxJ; ew.assertNotNull("document should not be null", textDocument2); if (z) { mfl mfl2 = textDocument2.oRd; mui[] muiArr = value2.pmB; if (muiArr != null) { ofp.a(eeJ, odf, mua, mfl2, muiArr); } } odf.endElement("w:abstractNum"); Vk(5); } for (Map.Entry<Integer, muc> entry3 : hashMap.entrySet()) { Integer key3 = entry3.getKey(); ew.assertNotNull("numId should not be null", key3); int index2 = mud.getIndex(key3.intValue()); ew.eH(); muc value3 = entry3.getValue(); ew.assertNotNull("lfoData should not be null", value3); ofp.a(eeJ, index2, value3, odf); Vk(5); } odf.endElement("w:numbering"); odf.close(); h.BVU.close(); } private static void b(ode ode) throws IOException { abgb abgb = abgb.CNy; ew.assertNotNull("mMainDocPart should not be null", ode.qsD); ew.assertNotNull("relation should not be null", abgb); aago a = ode.qsD.a(abgb, abfq.heV()); ew.assertNotNull("part should not be null", a); OutputStream outputStream = a.BVU.getOutputStream(); ew.assertNotNull("os should not be null", outputStream); String str = ode.pxJ.oRR.eXh; FileInputStream fileInputStream = str != null ? new FileInputStream(str) : Platform.Hc().open("OfficeTheme.xml"); while (true) { try { int read = fileInputStream.read(qtr); if (read > 0) { outputStream.write(qtr, 0, read); } else { return; } } catch (IOException e) { hm.e(TAG, "IOException: ", e); if (eia.e(e)) { throw e; } return; } finally { lul.closeQuietly(fileInputStream); } } } private static void c(ode ode) throws IOException { Set<odd> keySet = ode.qsH.keySet(); if (!keySet.isEmpty()) { int i = 1; for (odd odd : keySet) { ew.assertNotNull("chart should not be null! ", odd); ekq ekq = odd.mChartOOXmlData; abfd abfd = ode.qsH.get(odd); ew.assertNotNull("chartData should not be null! ", abfd); try { File file = new File(ekq.eXf); if (!file.exists()) { ew.eI(); } else { FileInputStream fileInputStream = new FileInputStream(file); lul.e(fileInputStream, abfd.BVU.getOutputStream()); fileInputStream.close(); Iterator<String> it = ekq.bca().iterator(); while (it.hasNext()) { String next = it.next(); ogi.a(ode, ekq.oT(next), abfd, next); } String str = odd.mChartOOXmlData.eXg; if (str != null && str.length() > 0) { File file2 = new File(str); if (!file2.exists()) { ew.eI(); } else { abgb aiJ = abgb.aiJ(odd.qsA); ew.assertNotNull("descriptor should not be null! ", aiJ); int a = ogi.a(abfd, i, aiJ); FileInputStream fileInputStream2 = new FileInputStream(file2); OutputStream outputStream = null; if (odd.qsA.equals(abgb.COc.gVJ())) { outputStream = abfe.a(abfd, aiJ, a).BVU.getOutputStream(); } else if (odd.qsA.equals(abgb.COe.gVJ())) { outputStream = abfy.b(abfd, aiJ, a).BVU.getOutputStream(); } if (outputStream != null) { lul.e(fileInputStream2, outputStream); } fileInputStream2.close(); } } nmf nmf = odd.qsB; if (nmf != null) { a(nmf, abfd, i); } String str2 = ekq.eXi; if (str2 != null) { aago a2 = abfd.a(abgb.COg, abfq.heV(), i); FileInputStream fileInputStream3 = new FileInputStream(str2); lul.e(fileInputStream3, a2.BVU.getOutputStream()); fileInputStream3.close(); } String str3 = ekq.eXj; if (str3 != null) { aago a3 = abfd.a(abgb.COf, abfq.heV(), i); FileInputStream fileInputStream4 = new FileInputStream(str3); lul.e(fileInputStream4, a3.BVU.getOutputStream()); fileInputStream4.close(); } String str4 = ekq.eXh; String str5 = ode.pxJ.oRR.eXh; if (str4 != null && (str5 == null || !str4.equals(str5))) { aago a4 = abfd.a(abgb.CNz, abfq.heV(), i); FileInputStream fileInputStream5 = new FileInputStream(str4); lul.e(fileInputStream5, a4.BVU.getOutputStream()); fileInputStream5.close(); } i++; } } catch (FileNotFoundException e) { hm.e(TAG, "FileNotFoundException", e); } catch (IOException e2) { hm.e(TAG, "IOException", e2); if (eia.e(e2)) { throw e2; } } } } } public static void c(ode ode, mdl mdl, msa.a aVar, odf odf, oey oey, int i, int i2, int i3) throws IOException { int i4; boolean z; int i5; String str; boolean z2; msq.a b; String str2; String str3 = a(ode) ? "m:r" : "w:r"; oey.a(ode, ode.Vj(i), odf, i); kgd dGK = aVar.dGK(); odi odi = ode.qsW; odi.a(dGK, odf); String[] strArr = ode.qsV; if (dGK == null || dGK.mCount == 0) { i4 = 0; } else { i4 = 0; Object sp = dGK.sp(50); if (sp != null) { strArr[0] = "w:rsidR"; i4 = 2; strArr[1] = String.format("%08X", sp); } Object sp2 = dGK.sp(49); if (sp2 != null) { int i6 = i4 + 1; strArr[i4] = "w:rsidDel"; i4 = i6 + 1; strArr[i6] = String.format("%08X", sp2); } Object sp3 = dGK.sp(51); if (sp3 != null) { int i7 = i4 + 1; strArr[i4] = "w:rsidRPr"; i4 = i7 + 1; strArr[i7] = String.format("%08X", sp3); } } odf.b(str3, ode.qsV, i4); oft.a(odf, dGK); oft.b(ode, odf, dGK); if (i3 > ode.qsR.length) { ode.qsR = new char[(i3 + 32)]; } char[] cArr = ode.qsR; mdl.c(i2, i2 + i3, cArr, 0); if (mdl.dDW().e(aVar)) { char c = cArr[0]; Vk(1); ejz sd = mdl.bbf().sd(mdl.dEd().QJ(aVar.position()).eWz); ew.assertNotNull(sd); if (!qtp && sd != null) { boolean z3 = ode.qtd != null && ode.qtd.size() > 0; ejz g = sd.bbf().g(sd); if (g == null && ndz.q(sd)) { g = sd; } if (g != null ? true : sd.bbm() != null ? true : !sd.bbq() && sd.baS() != null && sd.bbv() == null && 201 != sd.baM() && !z3) { ofh.a(ode, odf, sd); } else if (z3 || !qto || '\b' == c) { if (z3) { z = true; } else { int baM = sd.baM(); z = (136 > baM || baM > 175 || sd.baT() == null) ? 201 == baM : true; } if (z || sd.bbq() || sd.eWA || (sd.bbv() != null && ode.qsZ)) { ofs.a(ode, odf, sd, qto); } else { odf.i("mc:AlternateContent", new String[0]); eoq bbn = sd.bbn(); String str4 = sd.bba() ? "wpg" : Qing3rdLoginConstants.WPS_UTYPE; if (bbn != null && bbn.bja() == 0 && sd.bbb()) { qtp = true; str4 = "wpc"; } odf.i("mc:Choice", "Requires", str4); ofh.a(ode, odf, sd); odf.endElement("mc:Choice"); odf.i("mc:Fallback", new String[0]); ofs.a(ode.eeJ(), odf, sd, qto); odf.endElement("mc:Fallback"); odf.endElement("mc:AlternateContent"); } } } ode.hE(i, i3); } else if (!aVar.dGK().getBoolean(28, false)) { if (i == 0) { ode eeJ = ode.eeJ(); msq.a a = oez.a(eeJ, i, i2); if (a != null && a.pjU == 0) { msr.a aVar2 = a.pjV; ew.assertNotNull("txtNode should not be null! ", aVar2); odf.j("w:endnoteReference", "w:customMarkFollows", "1", "w:id", Integer.toString(ofi.Vt(aVar2.dOw()))); } msq.a b2 = oez.b(eeJ, i, i2); if (b2 != null && b2.pjU == 0) { msr.a aVar3 = b2.pjV; ew.assertNotNull("txtNode should not be null! ", aVar3); odf.j("w:footnoteReference", "w:customMarkFollows", "1", "w:id", Integer.toString(ofm.Vt(aVar3.dOw()))); } } int i8 = 0; while (i8 < i3) { int i9 = i8; while (i9 < i3 && !aB(cArr[i9]) && !d(cArr[i9], dGK) && !aC(cArr[i9])) { i9++; } if (i9 > i8) { String str5 = ode.eeL() == 1 ? ode.qsW.qty == 1 ? "w:delInstrText" : "w:instrText" : a(ode) ? "m:t" : ode.qsW.qty == 1 ? "w:delText" : "w:t"; if (ode.eeL() != 1 || !qto) { if (cArr[i8] == ' ' || cArr[i9 - 1] == ' ') { odf.i(str5, "xml:space", "preserve"); } else { odf.i(str5, new String[0]); } if (cArr != null) { while (i8 < i9) { int i10 = i8 + 1; char c2 = cArr[i8]; if (!ndz.as(c2)) { i8 = i10; } else if (!odo.a(i10, i9, c2, cArr)) { switch (c2) { case '\n': odf.r(odo.pBJ, 0, odo.pBJ.length); i8 = i10; break; case '\"': odf.r(odo.pBI, 0, odo.pBI.length); i8 = i10; break; case '&': odf.r(odo.pBG, 0, odo.pBG.length); i8 = i10; break; case '\'': odf.r(odo.pBH, 0, odo.pBH.length); i8 = i10; break; case '<': odf.r(odo.pBE, 0, odo.pBE.length); i8 = i10; break; case '>': odf.r(odo.pBF, 0, odo.pBF.length); i8 = i10; break; default: odf.aE(c2); i8 = i10; break; } } else { i8 = i10 + 1; odf.e(c2, cArr[i10]); } } } odf.endElement(str5); } } if (i9 < i3) { if (aB(cArr[i9])) { char c3 = cArr[i9]; switch (c3) { case '\t': odf.j("w:tab", new String[0]); continue; case '\n': default: new StringBuilder("Unrecognized break char is met: ").append(c3); ew.eI(); continue; case 11: case '\f': case 14: String[] strArr2 = new String[4]; int i11 = 0; switch (c3) { case 11: break; case '\f': strArr2[0] = "w:type"; i11 = 2; strArr2[1] = "page"; break; case '\r': default: new StringBuilder("Unrecognized break char is met: ").append(c3); ew.eI(); break; case 14: strArr2[0] = "w:type"; i11 = 2; strArr2[1] = "column"; break; } Object sp4 = dGK.sp(22); if (sp4 != null) { int i12 = i11 + 1; strArr2[i11] = "w:clear"; i11 = i12 + 1; switch (((mzj) sp4).aGw) { case 0: str2 = "nones"; break; case 1: str2 = "left"; break; case 2: str2 = "right"; break; case 3: str2 = SpeechConstant.PLUS_LOCAL_ALL; break; default: ew.eI(); str2 = "nones"; break; } strArr2[i12] = str2; } odf.a("w:br", strArr2, i11); continue; case '\r': odf.j("w:cr", new String[0]); continue; } } else if (d(cArr[i9], dGK)) { ArrayList<String> arrayList = new ArrayList<>(); String string = dGK.getString(19); ew.assertNotNull("fontSymbol should not be null!", string); arrayList.add("w:font"); arrayList.add(string); Integer valueOf = Integer.valueOf(dGK.getInt(20)); ew.assertNotNull("charSymbol should not be null!", valueOf); arrayList.add("w:char"); arrayList.add(Integer.toHexString(valueOf.intValue())); odf.d("w:sym", arrayList); odf.endElement("w:sym"); } else if (aC(cArr[i9])) { odf.j("w:noBreakHyphen", new String[0]); } } i8 = i9 + 1; } ode.hE(i, i3); Vk(i3); } else { for (int i13 = 0; i13 < i3; i13++) { char c4 = cArr[i13]; if (5 == c4) { if (i == 0) { ew.eH(); TextDocument textDocument = ode.pxJ; ew.assertNotNull("textDoc should not be null!", textDocument); mdl dDT = textDocument.dDT(); ew.assertNotNull("mainDoc should not be null!", dDT); msm dEp = dDT.dEp(); int Vj = ode.Vj(i); msm.d Qg = dEp.Qg(Vj); ew.eK(); if (Qg != null) { if (Qg.dOw() != Vj) { oez.a(odf); } else { Integer Vs = ofc.Vs(Qg.oSW.dOw()); ew.assertNotNull("commentID should not be null!", Vs); odf.j("w:commentReference", "w:id", Integer.toString(Vs.intValue())); } } } else if (3 == i) { oez.a(odf); } else { ew.eI(); } } else if (2 == c4) { switch (i) { case 0: msq.a a2 = oez.a(ode, i, ode.Vj(i)); if (a2 == null) { z2 = false; } else { msr.a aVar4 = a2.pjV; ew.assertNotNull("txtNode should not be null! ", aVar4); odf.j("w:endnoteReference", "w:id", Integer.toString(ofi.Vt(aVar4.dOw()))); z2 = true; } if (!z2 && (b = oez.b(ode, i, ode.Vj(i))) != null) { msr.a aVar5 = b.pjV; ew.assertNotNull("txtNode should not be null! ", aVar5); odf.j("w:footnoteReference", "w:id", Integer.toString(ofm.Vt(aVar5.dOw()))); break; } case 1: odf.j("w:footnoteRef", new String[0]); continue; case 2: case 3: default: ew.eI(); continue; case 4: odf.j("w:endnoteRef", new String[0]); continue; } } else { msj.h Ov = mdl.dEh().Ov(i2 + i13); if (Ov == null || mdl.dEh().b(Ov)) { i5 = 0; } else { msp.a aVar6 = (msp.a) Ov; a(ode, aVar6, mdl, aVar); i5 = aVar6.flp; } if (c4 == 19) { boolean z4 = false; if (i5 == mur.FieldEmbed.ppZ || i5 == mur.FieldShape.ppZ) { z4 = aVar.dGK().getBoolean(758, false); if (95 == mur.FieldShape.ppZ) { z4 = true; } } qto = z4; ode.c(1, qto, qtp); str = "begin"; } else if (c4 == 20) { str = "separate"; ode.qsS[ode.qsT - 1].mStatus = 0; } else if (c4 == 21) { str = "end"; ode.qsT--; qto = ode.qsS[ode.qsT - 1].qtf; } if (!qto) { odf.j("w:fldChar", "w:fldCharType", str); } if (c4 == 21) { qto = ode.eeK().qtf; qtp = ode.eeK().qtg; } } ode.hE(i, 1); } } odf.endElement(str3); odi.b(dGK, odf); oey.a(ode, ode.Vj(i), odf, i); } private static boolean d(char c, kgd kgd) { return ('(' != c || ((String) kgd.sp(19)) == null || ((Integer) kgd.sp(20)) == null) ? false : true; } private static void dispose() { qtm = null; ojy.clear(); ofc.dispose(); ofu.dispose(); ofi.dispose(); ofm.dispose(); } private void eeN() throws IOException { ode eeJ = ode.eeJ(); ew.assertNotNull("dctx should not be null", eeJ); eeJ.eeM(); TextDocument textDocument = eeJ.pxJ; ew.assertNotNull("textDoc should not be null", textDocument); mgh mgh = (mgh) textDocument.Oe(2); if (mgh != null) { for (Map.Entry<abfv, ogk> entry : eeJ.qsG.entrySet()) { abfv key = entry.getKey(); ogk value = entry.getValue(); ew.assertNotNull("part should not be null", key); ew.assertNotNull("nodesCp should not be null", value); ew.assertNotNull("part should not be null!", key); ew.assertNotNull("nodesCp should not be null!", value); ew.assertNotNull("headerDoc should not be null!", mgh); a(key, mgh, value.oZh, value.oZi); switch (value.qvF) { case Header: ew.assertNotNull("headerFooter should not be null.", key); ew.assertNotNull("headerNodes should not be null.", value); ew.assertNotNull("headerDoc should not be null.", mgh); ode.eeJ().qsO = 2; odf odf = new odf(key.BVU.getOutputStream(), key); ew.assertNotNull("w should not be null.", odf); ew.assertNotNull("subDoc should not be null.", mgh); ofn.a("w:hdr", value, mgh, odf, 2); odf.close(); key.BVU.close(); break; case Footer: ew.assertNotNull("footer should not be null.", key); ew.assertNotNull("footerNodesCp should not be null.", value); ew.assertNotNull("footerDoc should not be null.", mgh); ode.eeJ().qsO = 2; odf odf2 = new odf(key.BVU.getOutputStream(), key); ew.assertNotNull("w should not be null.", odf2); ew.assertNotNull("subDoc should not be null.", mgh); ofn.a("w:ftr", value, mgh, odf2, 2); odf2.close(); key.BVU.close(); break; } ojy.clear(); } } } private void eeO() { Map<String, List<abfz>> map = ode.eeJ().qsE; if (!(map == null || map.isEmpty())) { for (Map.Entry<String, List<abfz>> entry : map.entrySet()) { List<abfz> value = entry.getValue(); ew.eK(); if (value != null) { String key = entry.getKey(); ew.assertNotNull("pictureFile should not be null", key); int size = value.size(); for (int i = 0; i < size; i++) { a(value.get(i).BVU, key); } } } } } private void eeP() { Map<String, abfy> map = ode.eeJ().qsF; if (!(map == null || map.isEmpty())) { for (Map.Entry<String, abfy> entry : map.entrySet()) { a(entry.getValue().BVU, entry.getKey()); } } } private static void eeQ() { Map<zig, aaol> map = ode.eeJ().qsM; if (!(map == null || map.isEmpty())) { for (Map.Entry<zig, aaol> entry : map.entrySet()) { try { new zip(entry.getValue().BVU.getOutputStream(), "UTF8").aeN(entry.getKey().gLS()); } catch (UnsupportedEncodingException e) { hm.e(TAG, "UnsupportedEncodingException", e); } } } } @Override // defpackage.now public final void nq() throws aazi, IOException { if (this.oRs == null || this.oRs.aPC == null || this.oRs.aPC.length() == 0) { MS(mPath); return; } String fH = ogi.fH("modifyTemp", ".docx"); ew.assertNotNull("tempFilePath should not be null!", fH); MS(fH); String str = mPath; String str2 = this.oRs.aPC; bcf bcf = new bcf(); bcf.setOpenPassword(str2); String fH2 = ogi.fH("enTemp", ".docx"); ew.assertNotNull("tempFileStr should not be null!", fH2); bcf.a(new File(fH), new File(str), fH2); new File(fH).delete(); } }